#! /bin/sh

# Copyright (C) 2009-2017 Lightbend Inc. <https://www.lightbend.com>

year=`date +%Y`
cd manual
for f in `find . -name '*.md'`
do
  echo "<!--- Copyright (C) 2009-$year Lightbend Inc. <https://www.lightbend.com> -->" > /tmp/mdcw
  if head -n 1 $f | grep -qiE "(Lightbend|Typesafe) Inc. <https?://(www.)?(lightbend|typesafe).com"
  then
    tail -n +2 $f >> /tmp/mdcw
  else
    cat $f >> /tmp/mdcw
  fi
  cp /tmp/mdcw $f
  rm /tmp/mdcw
  echo Updated $f
done

